<template>
  <div class="error-container">
    <div class="error-content">
      <div class="error-code">500</div>
      <div class="error-message">服务器内部错误</div>
      <p class="error-description">
        抱歉，服务器发生了内部错误，请稍后再试
      </p>
      <div class="error-actions">
        <el-button type="primary" @click="handleRefresh">
          <el-icon><Refresh /></el-icon>
          刷新页面
        </el-button>
        <el-button @click="handleGoHome">
          <el-icon><Home /></el-icon>
          返回首页
        </el-button>
      </div>
    </div>
  </div>
</template>

<script setup>
import { useRouter } from 'vue-router'
import { Refresh, Home } from '@element-plus/icons-vue'

const router = useRouter()

// 刷新当前页面
const handleRefresh = () => {
  window.location.reload()
}

// 返回首页
const handleGoHome = () => {
  router.push('/')
}
</script>

<style scoped>
.error-container {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: #f5f7fa;
  padding: 20px;
}

.error-content {
  text-align: center;
  background-color: #fff;
  padding: 50px 80px;
  border-radius: 8px;
  box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
}

.error-code {
  font-size: 80px;
  font-weight: 700;
  color: #ff4d4f;
  margin-bottom: 20px;
  line-height: 1;
}

.error-message {
  font-size: 20px;
  color: #1f2329;
  margin-bottom: 10px;
}

.error-description {
  color: #86909c;
  margin-bottom: 30px;
  max-width: 400px;
  line-height: 1.5;
}

.error-actions {
  display: flex;
  gap: 16px;
  justify-content: center;
}
</style>
